class Service::TaskController < Service::ServiceController

  def add
    project_name = params[:project_name]
    task_name = params[:task_name]
    created_date = params[:created_date]
    time_spent = params[:time_spent]
    due_date = params[:due_date]
    assign_to = params[:assign_to]
    twitter_user_id = params[:twitter_user_id]

    message = Task.add_task(project_name, task_name, due_date, created_date, assign_to, twitter_user_id, time_spent)

    render :json => {:message => message}
  end

  def complete
    name = params[:name]
    twitter_user_id = params[:twitter_user_id]
    time_spent = params[:time_spent]

    Task.complete(name, twitter_user_id, time_spent)

    render :json => {:message => 'task completed'}
  end

  def postpone
    name = params[:name]
    twitter_user_id = params[:twitter_user_id]
    new_due_date = params[:new_due_date]

    Task.postpone(name, twitter_user_id, new_due_date)

    render :json => {:message => 'task postponed'}
  end

end
